package com.bjpowerrnode.javase.array;

//当一个方法的参数数数组的时候，
public class ArrayTest04 {
    public static void main(String[] args) {
        //静态初始化一维数组
        int[] a = {1,2,3};
        printArray(a);

        //动态初始化一维数组
        int[] a1 = new int[4];
        printArray(a1);

        System.out.println("=====================");
        printArray(new int[3]);

        System.out.println("======================");
        //没有这种语法
        //printArray({1,2,3});

        System.out.println("======================");
        printArray(new int[] {1,2,3});

    }


    public static void printArray(int[] array){
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }
}
